﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Xmpp: StateForge::Examples::XmppChat::XmppDb Class Reference</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                C# examples using state machines generated by StateBuilderDotNet
            </h1>
            <h3>
                Xmpp: StateForge::Examples::XmppChat::XmppDb Class Reference
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespace_state_forge.html">StateForge</a>      </li>
      <li class="navelem"><a class="el" href="namespace_state_forge_1_1_examples.html">Examples</a>      </li>
      <li class="navelem"><a class="el" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html">XmppChat</a>      </li>
      <li class="navelem"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html">XmppDb</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#properties">Properties</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="#pri-static-attribs">Static Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">StateForge::Examples::XmppChat::XmppDb Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="StateForge::Examples::XmppChat::XmppDb" -->
<p><a href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#ac3c28f80903e55f567502a37482ecd1f">XmppDb</a> (string connectionString)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#ac979129f15542f301a4107154e52f939">Open</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a93836b4c9938a865ba604678c5a37e33">Close</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a0b295d0cdb9a37d0aad92aaa868f159f">UserRemove</a> (string user)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a7ea784655786f639fe7002f248001202">UserAdd</a> (string user, string password)</td></tr>
<tr><td colspan="2"><h2><a name="properties"></a>
Properties</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#aa5d5e2e48d71c99f89e641a30f68b8ad">ConnectionString</a><code> [get, set]</code></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a624eeaf08afcb433a6defb3b023415ed">Query</a> (string queryString)</td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">OdbcConnection&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">connection</a></td></tr>
<tr><td colspan="2"><h2><a name="pri-static-attribs"></a>
Static Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static readonly string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a597aa4e7cbce6779a56b6008e54f4e8d">traceName</a> = &quot;Db&quot;</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static TraceSource&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">ts</a> = new TraceSource(<a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a597aa4e7cbce6779a56b6008e54f4e8d">traceName</a>)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock">
<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00012">12</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ac3c28f80903e55f567502a37482ecd1f"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::XmppDb" ref="ac3c28f80903e55f567502a37482ecd1f" args="(string connectionString)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StateForge::Examples::XmppChat::XmppDb::XmppDb </td>
          <td>(</td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>connectionString</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00019">19</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
<div class="fragment"><pre class="fragment">        {
            <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">ts</a>.TraceInformation(<span class="stringliteral">&quot;connection string {0}&quot;</span>, connectionString);
            this.<a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#aa5d5e2e48d71c99f89e641a30f68b8ad">ConnectionString</a> = connectionString;
        }
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a93836b4c9938a865ba604678c5a37e33"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::Close" ref="a93836b4c9938a865ba604678c5a37e33" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void StateForge::Examples::XmppChat::XmppDb::Close </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00031">31</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
<div class="fragment"><pre class="fragment">        {
            this.<a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">connection</a>.Close();
        }
</pre></div>
</div>
</div>
<a class="anchor" id="ac979129f15542f301a4107154e52f939"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::Open" ref="ac979129f15542f301a4107154e52f939" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void StateForge::Examples::XmppChat::XmppDb::Open </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00025">25</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
<div class="fragment"><pre class="fragment">        {
            this.<a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">connection</a> = <span class="keyword">new</span> OdbcConnection(this.<a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#aa5d5e2e48d71c99f89e641a30f68b8ad">ConnectionString</a>);
            this.<a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">connection</a>.Open();
        }
</pre></div>
</div>
</div>
<a class="anchor" id="a624eeaf08afcb433a6defb3b023415ed"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::Query" ref="a624eeaf08afcb433a6defb3b023415ed" args="(string queryString)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void StateForge::Examples::XmppChat::XmppDb::Query </td>
          <td>(</td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>queryString</em></td><td>)</td>
          <td><code> [inline, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00050">50</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
<div class="fragment"><pre class="fragment">        {
            <span class="keywordflow">if</span> (this.<a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">connection</a> == null)
            {
                <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#ac979129f15542f301a4107154e52f939">Open</a>();
            }

            <span class="keywordflow">try</span>
            {
                var command = <span class="keyword">new</span> OdbcCommand(queryString, <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">connection</a>);
                <span class="keywordtype">int</span> row = command.ExecuteNonQuery();
                <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">ts</a>.TraceEvent(TraceEventType.Error, 1, <span class="stringliteral">&quot;row: {0}&quot;</span>, row);
            }
            <span class="keywordflow">catch</span> (OdbcException exception)
            {
                <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">ts</a>.TraceEvent(TraceEventType.Error, 1, <span class="stringliteral">&quot;error: {0}&quot;</span>, exception.Message);
            }
        }
</pre></div>
</div>
</div>
<a class="anchor" id="a7ea784655786f639fe7002f248001202"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::UserAdd" ref="a7ea784655786f639fe7002f248001202" args="(string user, string password)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void StateForge::Examples::XmppChat::XmppDb::UserAdd </td>
          <td>(</td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>user</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>password</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00043">43</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
<div class="fragment"><pre class="fragment">        {
            <span class="keywordtype">string</span> queryString = <span class="stringliteral">&quot;insert into users (username,password) value (&#39;&quot;</span> + user + <span class="stringliteral">&quot;&#39;,&#39;&quot;</span> + password + <span class="stringliteral">&quot;&#39;) ;&quot;</span>;
            <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">ts</a>.TraceInformation(<span class="stringliteral">&quot;UserAdd {0} &quot;</span>, queryString);
            <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a624eeaf08afcb433a6defb3b023415ed">Query</a>(queryString);
        }
</pre></div>
</div>
</div>
<a class="anchor" id="a0b295d0cdb9a37d0aad92aaa868f159f"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::UserRemove" ref="a0b295d0cdb9a37d0aad92aaa868f159f" args="(string user)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void StateForge::Examples::XmppChat::XmppDb::UserRemove </td>
          <td>(</td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>user</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00036">36</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>
<div class="fragment"><pre class="fragment">        {
            <span class="keywordtype">string</span> queryString = <span class="stringliteral">&quot;DELETE FROM users WHERE username=&#39;&quot;</span> + user + <span class="stringliteral">&quot;&#39;;&quot;</span>;
            <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">ts</a>.TraceInformation(<span class="stringliteral">&quot;UserRemove {0}&quot;</span>, queryString);
            <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a624eeaf08afcb433a6defb3b023415ed">Query</a>(queryString);
        }
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a06a6f232cd6ca1ef1354f5a670bdfd14"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::connection" ref="a06a6f232cd6ca1ef1354f5a670bdfd14" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OdbcConnection <a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a06a6f232cd6ca1ef1354f5a670bdfd14">StateForge::Examples::XmppChat::XmppDb::connection</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00015">15</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>

</div>
</div>
<a class="anchor" id="a597aa4e7cbce6779a56b6008e54f4e8d"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::traceName" ref="a597aa4e7cbce6779a56b6008e54f4e8d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">readonly string <a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a597aa4e7cbce6779a56b6008e54f4e8d">StateForge::Examples::XmppChat::XmppDb::traceName</a> = &quot;Db&quot;<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00016">16</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>

</div>
</div>
<a class="anchor" id="a4849b249816d75318c4979e53f5f63f2"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::ts" ref="a4849b249816d75318c4979e53f5f63f2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">TraceSource <a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a4849b249816d75318c4979e53f5f63f2">StateForge::Examples::XmppChat::XmppDb::ts</a> = new TraceSource(<a class="el" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_xmpp_db.html#a597aa4e7cbce6779a56b6008e54f4e8d">traceName</a>)<code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00017">17</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>

</div>
</div>
<hr/><h2>Property Documentation</h2>
<a class="anchor" id="aa5d5e2e48d71c99f89e641a30f68b8ad"></a><!-- doxytag: member="StateForge::Examples::XmppChat::XmppDb::ConnectionString" ref="aa5d5e2e48d71c99f89e641a30f68b8ad" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">string StateForge::Examples::XmppChat::XmppDb::ConnectionString<code> [get, set]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_xmpp_db_8cs_source.html#l00014">14</a> of file <a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_xmpp_db_8cs_source.html">XmppDb.cs</a></li>
</ul>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
